#!/bin/bash

# grub timeout
sudo sed -i -r 's/GRUB_TIMEOUT=[0-9]*$/GRUB_TIMEOUT=1/' /etc/default/grub
sudo grub2-mkconfig -o /boot/grub2/grub.cfg

# mirrors
#
sudo sed -e 's|^mirrorlist=|#mirrorlist=|g' \
	-e 's|^#baseurl=http://dl.rockylinux.org/$contentdir|baseurl=https://mirrors.ustc.edu.cn/rocky|g' \
	-i.bak \
	/etc/yum.repos.d/rocky-extras.repo \
	/etc/yum.repos.d/rocky-devel.repo \
	/etc/yum.repos.d/rocky.repo
sudo dnf config-manager --set-enabled devel

# epel
sudo dnf config-manager --set-enabled crb
sudo dnf install -y epel-release
sudo sed -e 's|^metalink=|#metalink=|g' \
	-e 's|^#baseurl=https\?://download.fedoraproject.org/pub/epel/|baseurl=https://mirrors.ustc.edu.cn/epel/|g' \
	-e 's|^#baseurl=https\?://download.example/pub/epel/|baseurl=https://mirrors.ustc.edu.cn/epel/|g' \
	-i.bak \
	/etc/yum.repos.d/epel.repo
sudo dnf config-manager --set-disabled epel-cisco-openh264
sudo dnf clean all

sudo dnf makecache

#neovim
# sudo dnf install -y https://gitee.com/hevey88/kitty/releases/download/0.9.4/nvim-linux64.rpm
sudo dnf install -y neovim wget lua-devel luarocks npm git-lfs g++ python3-pip fd-find ripgrep tar
npm config set registry https://registry.npmmirror.com
python3 -m pip config set global.index-url https://mirrors.bfsu.edu.cn/pypi/web/simple

/bin/bash -c "$(curl -fsSL https://gitee.com/hevey88/install_script/raw/main/nvim_config.sh)"
# luarocks config variables.LUA_INCDIR /usr/include/
